package com.aaa.controller;

import com.aaa.pojo.Student;
import com.aaa.service.ClassService;
import com.aaa.util.Result;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class ClassController {
    @Autowired
    private ClassService classService;
    //@PutMapping  查询 get提交  删除 delete  修改 PUT提交  添加 post提交

    @GetMapping("findById/{cid}") //restful风格 PathVariable请求地址种{}中的内容
    public Result findAll(@PathVariable Integer cid){
        return classService.findAll(cid);
    }

    @PostMapping("insert")
    public void insert(@RequestBody Student student){
        classService.insert(student);
    }

    @PutMapping("workupdate")
    public void update(@RequestBody Student student){
        classService.updateById(student);
    }

    @Delete("deleteById/{sId")
    public void delete(@PathVariable Integer sId){
        classService.deleteById(sId);
    }
}
